import {localeProps} from '../../utils';

const label = '文字';
const name = 'span';

export default {
  icon: 'icon-span',
  label,
  name,
  rule({t}) {
    return {
      type: 'div',
      title: '',
      native: true,
      children: [t('components.span.name')],
    };
  },
  watch: {
    formCreateNative({value, rule}) {
      if (value) {
        rule.title = '';
      }
    }
  },
  props(_, {t}) {
    return localeProps(t, name + '.props',
      [
        {
          type: 'switch',
          title: '是否显示标题',
          field: 'formCreateNative',
          props: {
            checkedValue: false,
            uncheckedValue: true,
            defaultChecked: true,
          },
          control: [{value: false, rule: ['formCreateTitle']}]
        },
        {
          type: 'input',
          field: 'formCreateTitle',
        },
        {
          type: 'input',
          field: 'formCreateChild',
          props: {
            type: 'textarea'
          }
        }
      ]);
  }
};
